//树状数组 - 区间修改 + 单点查询
//创建原始树状数组的差分数组, 转化为单点修改和区间查询
#include <iostream>
using namespace std;
#define lowbit(x) (x & -x)
const int N = 1e6 + 10;
typedef long long ll;
ll a[N];
int n, q;

void modify(int x, ll k)
{
    for(int i = x; i <= n; i += lowbit(i)) a[i] += k;
}

ll query(ll x)
{
    ll sum = 0;
    for(int i = x; i; i -= lowbit(i)) sum += a[i];
    return sum;
}

int main()
{
    cin >> n >> q;
    //创建树状数组的差分数组
    for(int i = 1; i <= n; i++) 
    {
        ll x; cin >> x;
        modify(i, x);
        modify(i + 1, -x);
    }

    while(q--)
    {
        int op; cin >> op;
        if(op == 1)
        {
            int l, r; 
            ll x; 
            cin >> l >> r >> x;
            modify(l, x);
            modify(r + 1, -x);
        }
        else
        {
            int i; cin >> i;
            cout << query(i) << endl;
        }
    }
    return 0;
}